package dongbai.soft.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class UpdateTask {

    @Autowired
    RedisTemplate<String, String> redisTemplate;

    @Autowired
    RedisTemplate<String, Object> redisTemplate2;

    @Scheduled(cron = "0 0 0 * * ?")
    public void updateData() {
        String product = "Product:";
        redisTemplate.opsForList().leftPop(product + "outnum");
        redisTemplate.opsForList().rightPush(product + "outnum", "0");

        redisTemplate.opsForList().leftPop(product + "innum");
        redisTemplate.opsForList().rightPush(product + "innum", "0");

        redisTemplate.opsForList().leftPop(product + "outprice");
        redisTemplate.opsForList().rightPush(product + "outprice", "0");

        redisTemplate.opsForList().leftPop(product + "inprice");
        redisTemplate.opsForList().rightPush(product + "inprice", "0");
    }

}
